#coding:utf8
from rest_framework import serializers
from .models import Area
class AreaSerializer(serializers.ModelSerializer):

    class Meta:

        model = Area
        fields = ['id','name']

class SubsAreaSerializer(serializers.ModelSerializer):

    #注意, many=True 和 read_only为True
    subs = AreaSerializer(many=True,read_only=True)

    class Meta:
        model = Area
        fields = ['id','name','subs']
